﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Windows.Forms;
using NIKE_Project.DAL;

namespace NIKE_Project.BLL
{
    public class GoodsClassificationService
    {
        DBHelper db = new DBHelper();
        public int AddClass(string TypeName, string ParentID)
        {
            string Sqlinsert = string.Format("insert into Type(TypeName,ParentID) values ('{0}','{1}');", TypeName, ParentID);
            int rows = db.zsg(Sqlinsert);
            return rows;
        }
        public int ModifyClass(string TypeName, string ParentID, string TypeID) 
        {
            string Sqlupdate = string.Format("update Type set TypeName='{0}',ParentID='{1}' where TypeID='{2}'", TypeName, ParentID, TypeID);
            int rows = db.zsg(Sqlupdate);
            return rows;
        }
        public int DeleteClass(string TypeName, string ParentID)
        {
            string Sqlinsert = string.Format("delete from Type where TypeName = '{0}' and ParentID = '{1}'", TypeName, ParentID);
            int rows = db.zsg(Sqlinsert);
            return rows;
        }
    }
}
